package testJob;

public class JobRunner {
	private CaclJob[] jobs;
	
	public JobRunner(CaclJob[] jobs) {
		this.jobs = jobs;
	}
	
	public void runAllJobs() {
		for(CaclJob job:this.jobs) {
			if(job instanceof SQLJob) {
				SQLJob sqlJob = (SQLJob)job;
				if(sqlJob.ping(1000)) {
					sqlJob.run();
				}
			}else if (job instanceof FileServerJob){
				FileServerJob fileJob = (FileServerJob)job;
				if(fileJob.ping(1000)) {
					fileJob.run();
				}
			}else {
				job.run();
			}
		}
	}
}
